package com.atguigu.educms.controller;

import com.atguigu.commonutils.R;
import com.atguigu.educms.entity.EduCourse;
import com.atguigu.educms.entity.EduTeacher;
import com.atguigu.educms.service.EduCourseService;
import com.atguigu.educms.service.EduTeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/educms/hongpage")
public class HongPageController {
    @Autowired
    private EduCourseService eduCourseService;

    @Autowired
    private EduTeacherService eduTeacherService;

    @GetMapping("getAll")
    public R getAll(){
        List<EduCourse> course = eduCourseService.getCourse();
        List<EduTeacher> teacher = eduTeacherService.getTeacher();

        return R.ok().data("course",course).data("teacher",teacher);
    }
}
